package branch;

/**
 * @author 刘鹏飞
 * @ClassName TestIf2
 * @Date 2024/11/28 21:51
 * @Created by 刘鹏飞
 * @Description 测试if...else结构
 * if (条件1){
 * 代码体2
 * }else{
 * 代码体2
 * }
 */
public class TestIf02 {

    public static void main(String[] args) {


        double r = Math.random() * 5;
        double area = r * r * Math.PI;
        double circle = 2 * Math.PI * r;


        System.out.println("r = " + r);
        System.out.println("circle = " + circle);
        System.out.println("area = " + area);

        if (area >= circle) {
            System.out.println("面积大于等于周长的数值");
        } else {
            System.out.println("面积小于周长的数值");
        }


        int a = 2;
        int b = 5;

         int c= a>b? a:b;

        if (a>b){
            c=a;
        }else{
            c=b;
        }
    }
}
